<?php if(!defined('IN_FANWE')) exit('Access Denied'); ?>
<?php 
$css_list[0]['url'] = './tpl/css/club.css';
$js_list[0][] = './public/js/jquery.slides.js';
$js_list[0][] = './tpl/js/group.js';
 include template('inc/header'); ?><div id="body" class="wrapper">
<div class="piece1 mb20">
<div class="piece1_hd"></div><!--dynamic getNewBestTopics--><div class="piece1_ft"></div>
</div>
<div id="content_body_wrap" class="fl">
<div class="piece piece_wb" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div><!--dynamic getMeGroups--><div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<div class="piece piece_wb" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<h2 class="active_group_title" >活跃小组</h2>
<ul class="active_group_list clear_in" ><?php if(is_array($base_groups)) { foreach($base_groups as $group_item) { ?>      
<li>
<a class="fl" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><img class="r5 lazyload" height="80" original="<?php echo getImgName($group_item['icon']['img'],100,100,1); ?>" src="./tpl/images/lazyload.gif"/></a>
<h3 class="ag_t"><a class="glink" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><?php echo $group_item['name'];?></a></h3>
<p class="ag_i" ><span><b><?php echo $group_item['user_count'];?></b>成员</span> <span><b><?php echo $group_item['thread_count'];?></b>分享</span> </p>
<p class="ag_d" ><?php echo cutStr($group_item['content'],60,'...');?></p>
</li>
<?php } } ?>
</ul>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<div id="all_group" class="piece piece_wb">
<ul class="all_group_nav">
<li class="new"><a class="c" href="javascript:;" title="新晋" id="catenav_new">新晋</a></li><?php $index = 1; if(is_array($_FANWE['cache']['forum_category'])) { foreach($_FANWE['cache']['forum_category'] as $category) { ?><li class="cate_<?php echo $index;?>"><a href="#cate_groups_<?php echo $category['id'];?>" title="<?php echo $category['cate_name'];?>" id="catenav_<?php echo $category['id'];?>"><?php echo $category['cate_name'];?></a></li><?php $index++; } } ?>
</ul>
<div class="piece_bd">
   <div class="all_group_sort">
<h3 class="all_group_subtitle" >新晋</h3>
<ul class="all_group_list" ><?php if(is_array($new_groups)) { foreach($new_groups as $group_item) { ?>      
<li>
<a class="fl" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><img class="r5 lazyload" height="50" original="<?php echo getImgName($group_item['icon']['img'],100,100,1); ?>"  src="./tpl/images/lazyload.gif"/></a>
<h4 class="ag_t"><a class="glink" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><?php echo cutStr($group_item['name'],26,'...');?></a></h4>
<p class="ag_i" > <span><b><?php echo $group_item['user_count'];?>人</b></span> </p>
</li>
<?php } } ?>
</ul>
</div><?php if(is_array($group_cates)) { foreach($group_cates as $group_cate) { if($group_cate['forum_count'] > 16) { ?>
<div id="groups_box_<?php echo $group_cate['id'];?>" class="all_group_sort all_group_page">
<div class="all_group_subtitle" >
<?php echo $group_cate['cate_name'];?>
<a id="cate_groups_<?php echo $group_cate['id'];?>" class="more"><?php echo $group_cate['forum_count'];?>个小组</a>
<div class="all_group_subtitle_page vhide" isLoad="0" cid="<?php echo $group_cate['id'];?>" page="1" maxPage="2">
<img src="./tpl/images/loading_blue1.gif" />
<a class="gc_arr garight" href="javascript:;"></a>
<a class="gc_arr galeft galstop"  href="javascript:;"></a>
</div>
</div>
<?php } else { ?>
<div class="all_group_sort">
<div class="all_group_subtitle" >
<?php echo $group_cate['cate_name'];?>
<a id="cate_groups_<?php echo $group_cate['id'];?>" class="more"><?php echo $group_cate['forum_count'];?>个小组</a>
</div>
<?php } ?>
<ul class="all_group_list" ><?php if(is_array($group_cate['groups'])) { foreach($group_cate['groups'] as $group_item) { ?><li>
<a class="fl" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><img class="r5 lazyload" height="50" original="<?php echo getImgName($group_item['icon']['img'],100,100,1); ?>" src="./tpl/images/lazyload.gif"/></a>
<h4 class="ag_t"><a class="glink" href="<?php echo FU('group/detail',array("fid"=>$group_item['fid'])); ?>" target="_blank"><?php echo cutStr($group_item['name'],26,'...');?></a></h4>
<p class="ag_i" > <span><b><?php echo $group_item['user_count'];?>人</b></span> </p>
</li>
<?php } } ?>
</ul>
</div>
<?php } } ?>
</div>
</div>
<div class="clear"></div>
</div>
<div id="right_side" class="fr">
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<form action="<?php echo FU('search/group',array()); ?>" method="post" id="search_group">
<input type="text" name="keyword" class="search_txt fl" value="" autocomplete="off" tooltip="搜小组" />
<input type="submit" value=" " class="search_btn">
<input type="hidden" name="action" value="group" />
</form>
<div class="apply_group_box" ><a href="<?php echo FU('group/create',array()); ?>" class="apply_group"></a></div>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<?php if($_FANWE['setting']['group_admin_uid'] > 0 || $_FANWE['setting']['group_admin_fid'] > 0) { ?>
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<?php if($_FANWE['setting']['group_admin_uid'] > 0) { ?>
<h3 class="mt10">有事@小组小秘书</h3>
<ul class="mana_list" >
<li><?php echo setTplUserFormat($_FANWE['setting']['group_admin_uid'],0,1,'',0,'','','inc/getuser/group_admin'); ?></li>
</ul>
<?php } if($_FANWE['setting']['group_admin_fid'] > 0) { ?>
<h3><a target="_blank" href="<?php echo $_FANWE['setting']['group_admin_furl'];?>">更多</a><?php echo $_FANWE['setting']['group_admin_fname'];?></h3>
<ul class="guide_list"><?php if(is_array($admin_topics)) { foreach($admin_topics as $topic) { ?><li>
<p><a class="tlink" target="_blank" href="<?php echo $topic['url'];?>"><?php echo cutStr($topic['title'],28,'...');?></a></p>
</li>
<?php } } ?>
</ul>
<?php } ?>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<?php } ?>
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<h3>热门活动</h3>
<ul class="new_topic_list hot_group_event"><?php if(is_array($hot_events)) { foreach($hot_events as $event) { ?><li>
<p><a class="tlink" target="_blank" href="<?php echo $event['url'];?>"><?php echo cutStr($event['title'],28,'...');?></a></p>
</li>
<?php } } ?>
</ul>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<h3>热门投票</h3>
<ul class="new_topic_list hot_group_event"><?php if(is_array($hot_votes)) { foreach($hot_votes as $vote) { ?><li>
<p><a class="tlink" target="_blank" href="<?php echo $vote['url'];?>"><?php echo cutStr($vote['title'],28,'...');?></a></p>
</li>
<?php } } ?>
</ul>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<h3>优秀小组长</h3>
<ul class="group_daren_list" ><?php if(is_array($group_darens)) { foreach($group_darens as $daren) { ?><li>
<a href="<?php echo FU('u/index',array("uid"=>$daren['uid'])); ?>" target="_blank"><img class="fl avatar r3 lazyload" original="<?php echo getImgName($daren['img'],100,100,1); ?>"  height="80"  src="./tpl/images/lazyload.gif" /></a>
<div class="daren_info"><?php echo setTplUserFormat($daren['uid'],0,0,'',0,'','','inc/getuser/group_daren'); ?></div>
</li>
<?php } } ?>
</ul>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
<div class="piece piece_ws" >
<div class="piece_hd" > <b class="hl"></b> <b class="hr"></b> </div>
<div class="piece_bd">
<h3>最新主题</h3>
<ul class="new_topic_list"><?php if(is_array($new_topics)) { foreach($new_topics as $topic) { ?><li>
<p><a class="tlink" target="_blank" href="<?php echo $topic['url'];?>"><?php echo cutStr($topic['title'],28,'...');?></a></p>
<p class="gl_gt" ><a class="glink" target="_blank" href="<?php echo FU('group/detail',array("fid"=>$topic['fid'])); ?>"><?php echo cutStr($topic['group_name'],26,'...');?></a></p>
</li>
<?php } } ?>
</ul>
</div>
<div class="piece_ft" > <b class="fl"></b> <b class="fr"></b> </div>
</div>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript">
FANWE.NO_COUNTER = true;
jQuery(function($){
$(".all_group_nav a").click(function(){
$(".all_group_nav a").removeClass('c');
$(this).addClass('c');
});
$(".all_group_page").hover(function(){
$('.all_group_subtitle_page').addClass('vhide');
$('.all_group_subtitle_page',this).removeClass('vhide');
},function(){
if($('.all_group_subtitle_page',this).get(0).getAttribute('isLoad') == 0)
$('.all_group_subtitle_page',this).addClass('vhide');
});

$(".all_group_subtitle_page").each(function(){
var cate = this;
$(".galeft",this).click(function(){
var cid = cate.getAttribute('cid');
var page = parseInt(cate.getAttribute('page'));
var maxPage = parseInt(cate.getAttribute('maxPage'));
if(page <= 1)
{
$(this).addClass('galstop');
return;
}
page--;
$("img",cate).show();
cate.setAttribute('page',page);
cate.setAttribute('isLoad',1);
getCateGroups(cid,page,getCateGroupsResult);
});

$(".garight",this).click(function(){
var cid = cate.getAttribute('cid');
var page = parseInt(cate.getAttribute('page'));
var maxPage = parseInt(cate.getAttribute('maxPage'));
if(page >= maxPage)
{
$(this).addClass('garstop');
return;
}
$("img",cate).show();
page++;
cate.setAttribute('page',page);
cate.setAttribute('isLoad',1);
getCateGroups(cid,page,getCateGroupsResult);
});
});
});

function getCateGroupsResult(cid,result)
{
var cate = $("#groups_box_"+ cid +" .all_group_subtitle_page");
var cateObj = cate.get(0);
cateObj.setAttribute('isLoad',0);
$("img",cate).hide();
if(result)
{
cateObj.setAttribute('page',result.pager.page);
cateObj.setAttribute('maxPage',result.pager.page_count);
$(".galeft",cate).addClass('galstop');
$(".garight",cate).addClass('garstop');
if(result.pager.page < result.pager.page_count)
$(".garight",cate).removeClass('garstop');

if(result.pager.page > 1)
$(".galeft",cate).removeClass('galstop');

$("#groups_box_"+ cid +" .all_group_list").html(result.list);
}
}

function GroupUpdateUserFollow(obj,result)
{
var parent = $(obj).parent();
if(result.status == 1)
{
parent.html('<span class="followed">已关注</span>');
}
}
</script><?php include template('inc/footer'); ?>